package com.nuanshui.heatedloan.fund.vo;

import com.nuanshui.heatedloan.dal.BaseEntityImpl;

import java.util.Calendar;
import java.util.Date;

public class CrowdfundingVO extends BaseEntityImpl {

	/** 
	 * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么) 
	 */ 
	private static final long serialVersionUID = 1L;
	private String name;//众筹名称
	private Date createdAt;//创建时间
	private Date startSubscribeTime;//认购开始时间
	private Date stopSubscribeTime;//认购结束时间
	private Date startTime;//项目开始时间
	private Date stopTime;//项目结束时间
	private Integer blackoutPeriod;//封锁期
	private Integer annualYield;//年化收益率
	private Integer targetAmount;//资金总额
	private Integer startAmount;//起投金额
	private Integer limitGrades;//限制的购买份数，-1为不限制购买份数
	private Integer totalGrades;//总份数
	private String introduceId;//项目详情id
	private Integer status;//结算的状态 0，未结算  1，已结算
	private Integer subscribeStatus;//认购的状态   0，认购中  1，认购结束
	@SuppressWarnings("unused")
	private Integer projectStatus;//众筹项目的状态  0，即将开始 1，进行中 2，已结算
	@SuppressWarnings("unused")
	private Integer remainingTime;//剩余认购时间
	private Integer remainingMoney;//剩余可投额
	private Integer remainingGrades;//剩余份数
	
	@SuppressWarnings("unused")
	private String platform;//收款方式
	private Integer subscribeMoney;//认购金额
	private Integer expectEarning;//预期收益
	private Integer realEarning;//实际收益
	private Date subscribeTime;//认购时间
	private Integer grades;//认购份数
	private Integer buyGrades;//用户购买的总认购份数
	private Boolean isBuyLimit;//是否认购上限
	
	private String  showExpectEarning;
	
	
	public Integer getRemainingGrades() {
		return remainingGrades;
	}
	public void setRemainingGrades(Integer remainingGrades) {
		this.remainingGrades = remainingGrades;
	}
	public String getIntroduceId() {
		return introduceId;
	}
	public void setIntroduceId(String introduceId) {
		this.introduceId = introduceId;
	}
	public Integer getRemainingMoney() {
		return remainingMoney;
	}
	public void setRemainingMoney(Integer remainingMoney) {
		this.remainingMoney = remainingMoney;
	}
	public String getPlatform() {
		return "寻宝之旅钱包";
	}
	public void setPlatform(String platform) {
		this.platform = platform;
	}
	public Integer getBuyGrades() {
		return buyGrades;
	}
	public void setBuyGrades(Integer buyGrades) {
		this.buyGrades = buyGrades;
	}
	public Boolean getIsBuyLimit() {
		return isBuyLimit;
	}
	public void setIsBuyLimit(Boolean isBuyLimit) {
		this.isBuyLimit = isBuyLimit;
	}
	public Integer getGrades() {
		return grades;
	}
	public void setGrades(Integer grades) {
		this.grades = grades;
	}
	public Date getSubscribeTime() {
		return subscribeTime;
	}
	public void setSubscribeTime(Date subscribeTime) {
		this.subscribeTime = subscribeTime;
	}
	public Integer getExpectEarning() {
		return expectEarning;
	}
	public void setExpectEarning(Integer expectEarning) {
		this.expectEarning = expectEarning;
	}
	public Integer getRealEarning() {
		return realEarning;
	}
	public void setRealEarning(Integer realEarning) {
		this.realEarning = realEarning;
	}
	public Integer getSubscribeMoney() {
		return subscribeMoney;
	}
	public void setSubscribeMoney(Integer subscribeMoney) {
		this.subscribeMoney = subscribeMoney;
	}
	public Integer getRemainingTime() {
		if(this.getStopSubscribeTime() == null) return null;
	    Long currentTime = System.currentTimeMillis();
		Calendar cal1 = Calendar.getInstance();
        cal1.setTime(this.getStopSubscribeTime());
        Calendar cal2 = Calendar.getInstance();
        cal2.setTimeInMillis(currentTime);
        int day1= cal1.get(Calendar.DAY_OF_YEAR);
        int day2 = cal2.get(Calendar.DAY_OF_YEAR);
        if(day1-day2+1<0) return 0;
        return day1-day2+1;
	}
	public void setRemainingTime(Integer remainingTime) {
		this.remainingTime = remainingTime;
	}
	public Integer getSubscribeStatus() {
		if (this.subscribeStatus == null) {
			if(this.getStopSubscribeTime() == null) return null;
			Long currentTime = System.currentTimeMillis();
			Long stopSubscribeTime = this.getStopSubscribeTime().getTime();	
			long result = stopSubscribeTime-currentTime;
			if(result<=0) {
				return 1;
			} else {
				return 0;
			}
		} else {
			return this.subscribeStatus;
		}
	}
	public void setSubscribeStatus(Integer subscribeStatus) {
		this.subscribeStatus = subscribeStatus;
	}
	public Integer getProjectStatus() {
		if(this.getStartTime() == null) return null;
		if(this.getStopTime() == null) return null;
		Long currentTime = System.currentTimeMillis();
		Long startTime = this.getStartTime().getTime();
		if (currentTime < startTime) {
			return 0;
		} else {
			return this.getStatus();
		}
	}
	public void setProjectStatus(Integer projectStatus) {
		this.projectStatus = projectStatus;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Override
	public Date getCreatedAt() {
		return createdAt;
	}
	@Override
	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}
	public Date getStartSubscribeTime() {
		return startSubscribeTime;
	}
	public void setStartSubscribeTime(Date startSubscribeTime) {
		this.startSubscribeTime = startSubscribeTime;
	}
	public Date getStopSubscribeTime() {
		return stopSubscribeTime;
	}
	public void setStopSubscribeTime(Date stopSubscribeTime) {
		this.stopSubscribeTime = stopSubscribeTime;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public Date getStopTime() {
		return stopTime;
	}
	public void setStopTime(Date stopTime) {
		this.stopTime = stopTime;
	}
	public Integer getBlackoutPeriod() {
		return blackoutPeriod;
	}
	public void setBlackoutPeriod(Integer blackoutPeriod) {
		this.blackoutPeriod = blackoutPeriod;
	}
	public Integer getAnnualYield() {
		return annualYield;
	}
	public void setAnnualYield(Integer annualYield) {
		this.annualYield = annualYield;
	}
	public Integer getTargetAmount() {
		return targetAmount;
	}
	public void setTargetAmount(Integer targetAmount) {
		this.targetAmount = targetAmount;
	}
	public Integer getStartAmount() {
		return startAmount;
	}
	public void setStartAmount(Integer startAmount) {
		this.startAmount = startAmount;
	}
	public Integer getLimitGrades() {
		return limitGrades;
	}
	public void setLimitGrades(Integer limitGrades) {
		this.limitGrades = limitGrades;
	}
	public Integer getTotalGrades() {
		return totalGrades;
	}
	public void setTotalGrades(Integer totalGrades) {
		this.totalGrades = totalGrades;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	public  String getShowExpectEarning(){
         return showExpectEarning;
	}
	public void setShowExpectEarning(String showExpectEarning) {
		this.showExpectEarning = showExpectEarning;
	}
	
	
	
	
	
}
